home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8318 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  934 b 

  1. Path: access1.digex.net!not-for-mail
  2. From: ell@access1.digex.net (Ell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: novice question on copy constru
  5. Date: 16 Feb 1996 19:54:19 GMT
  6. Organization: The Universe
  7. Message-ID: <4g2ndb$4qh@news4.digex.net>
  8. References: <AL9SoXAZfTHxEwVN@mics.demon.co.uk> <4g0et8$3h6$2@mhadg.production.compuserve.com>
  9. NNTP-Posting-Host: access1.digex.net
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. John Puopolo (102262.612@CompuServe.COM) wrote:
  13. : It is recommended that you always supply:
  14. : A ctor
  15. : A dtor (virtual if approp)
  16. : A copy ctor
  17. : An assignment (=) operator
  18. : For every non-trivial class that you implement.  Leave nothing to 
  19. : chance and you'll have far fewer headaches.  Been there... done 
  20. : that.  
  21.  
  22. To add to this, the ctor, copy ctor, dtor, and op= are usually needed for
  23. classes with heap allocated members.  The dtor should be virtual when
  24. deriving classes from a base class. 
  25.  
  26. Elliott
  27.